package com.hk.demo.player;

import android.content.Context;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.hk.demo.player.http.ApiRepository;
import com.hk.player.core.DataCallback;
import com.hk.player.core.IHkPlayerProvider;
import com.hk.player.core.MonitorMediaData;

import androidx.annotation.NonNull;
import io.reactivex.disposables.Disposable;

/**
 * @author: zhoug
 * @since: 2025-08-07
 */
@Route(path = "/player/HkPlayerProvider")
public class HkPlayerProvider implements IHkPlayerProvider {
    private ApiRepository mApiRepository = new ApiRepository();

    @Override
    public void init(Context context) {

    }


    @Override
    public String getLoginUserId() {
        return "测试id";
    }

    @Override
    public Disposable getMonitorPlayUrl(@NonNull MonitorMediaData mediaData, int protocol, @NonNull DataCallback<MonitorMediaData> callback) {
        return mApiRepository.getFirmMonitorPlayUrlByPlayUrl(mediaData.getPlayUrl(), protocol, new DataCallback<String>() {
            @Override
            public void onSuccess(String s) {
                mediaData.setRealPlayUrl(s);
                callback.onSuccess(mediaData);
            }

            @Override
            public void onFailure(String error) {
                callback.onFailure(error);
            }
        });

    }

    @Override
    public Disposable getMonitorTalkUrl(@NonNull MonitorMediaData mediaData, @NonNull DataCallback<MonitorMediaData> callback) {

        return null;
    }


}
